package com.okq.entity;

import com.okq.entity.base.DataEntity;
import org.apache.commons.lang.StringUtils;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;

/**
 * 描述 : 产品表实体类
 * 作者 : zdl
 * 日期 : 2017/6/28 9:52
 */
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "tb_product")
public class Product extends DataEntity implements Serializable {
    private static final long serialVersionUID = -8653970897192569901L;
    /**
     * 生产Id
     */
    @Column(name = "productionId", length = 40)
    private String productionId;
    /**
     * 产品类型 1：农残 2：土肥 3：土壤墒情 4：农业气象站 5：...
     */
    @Column(name = "productType")
    private Integer productType;
    /**
     * 产品编号
     */
    @Column(name = "code", length = 10)
    private String code;
    /**
     * 产品名称
     */
    @Column(name = "name", length = 20)
    private String name;
    /**
     * 焊接人Id
     */
    @Column(name = "weldId", length = 40)
    private String weldId;
    /**
     * 焊接时间
     */
    @Column(name = "weldTime")
    private String weldTime;
    /**
     * 组装人Id
     */
    @Column(name = "assembleId", length = 40)
    private String assembleId;
    /**
     * 组装时间
     */
    @Column(name = "assembleTime")
    private String assembleTime;
    /**
     * 调试人Id
     */
    @Column(name = "debugId", length = 40)
    private String debugId;
    /**
     * 调试时间
     */
    @Column(name = "debugTime")
    private String debugTime;
    /**
     * 质检人Id
     */
    @Column(name = "checkId", length = 40)
    private String checkId;
    /**
     * 质检时间
     */
    @Column(name = "checkTime")
    private String checkTime;
    /**
     * 质检结果 0：未检测 1：合格 2：不合格
     */
    @Column(name = "checkResult")
    private Integer checkResult;
    /**
     * 库存状态 0：入库 1：出库
     */
    @Column(name = "stockState")
    private Integer stockState;
    /**
     * 出入库时间
     */
    @Column(name = "outOrInTime")
    private String outOrInTime;

    /* ------------------ 查询条件 ------------------*/
    /**
     * 生产批次模糊查询
     */
    @Transient
    private String batch;
    /**
     * 生产Ids
     */
    @Transient
    private String productionIds;
    /**
     * 开始时间
     */
    @Transient
    private String startTime;
    /**
     * 结束时间
     */
    @Transient
    private String endTime;
    /**
     * 操作人员Id
     */
    @Transient
    private String operator;

    public String getProductionId() {
        return productionId;
    }

    public void setProductionId(String productionId) {
        this.productionId = productionId;
    }

    public Integer getProductType() {
        return productType;
    }

    public void setProductType(Integer productType) {
        this.productType = productType;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getWeldId() {
        return weldId;
    }

    public void setWeldId(String weldId) {
        this.weldId = weldId;
    }

    public String getWeldTime() {
        if (StringUtils.isNotBlank(weldTime)) {
            weldTime = weldTime.substring(0, (weldTime.lastIndexOf(".")));
        }
        return weldTime;
    }

    public void setWeldTime(String weldTime) {
        this.weldTime = weldTime;
    }

    public String getAssembleId() {
        return assembleId;
    }

    public void setAssembleId(String assembleId) {
        this.assembleId = assembleId;
    }

    public String getAssembleTime() {
        if (StringUtils.isNotBlank(assembleTime)) {
            assembleTime = assembleTime.substring(0, (assembleTime.lastIndexOf(".")));
        }
        return assembleTime;
    }

    public void setAssembleTime(String assembleTime) {
        if (StringUtils.isNotBlank(assembleTime)) {
            assembleTime = assembleTime + ".0";
        }
        this.assembleTime = assembleTime;
    }

    public String getDebugId() {
        return debugId;
    }

    public void setDebugId(String debugId) {
        this.debugId = debugId;
    }

    public String getDebugTime() {
        if (StringUtils.isNotBlank(debugTime)) {
            debugTime = debugTime.substring(0, (debugTime.lastIndexOf(".")));
        }
        return debugTime;
    }

    public void setDebugTime(String debugTime) {
        if (StringUtils.isNotBlank(debugTime)) {
            debugTime = debugTime + ".0";
        }
        this.debugTime = debugTime;
    }

    public String getCheckId() {
        return checkId;
    }

    public void setCheckId(String checkId) {
        this.checkId = checkId;
    }

    public String getCheckTime() {
        if (StringUtils.isNotBlank(checkTime)) {
            checkTime = checkTime.substring(0, (checkTime.lastIndexOf(".")));
        }
        return checkTime;
    }

    public void setCheckTime(String checkTime) {
        if (StringUtils.isNotBlank(checkTime)) {
            checkTime = checkTime + ".0";
        }
        this.checkTime = checkTime;
    }

    public Integer getCheckResult() {
        return checkResult;
    }

    public void setCheckResult(Integer checkResult) {
        this.checkResult = checkResult;
    }

    public Integer getStockState() {
        return stockState;
    }

    public void setStockState(Integer stockState) {
        this.stockState = stockState;
    }

    public String getOutOrInTime() {
        if (StringUtils.isNotBlank(outOrInTime)) {
            outOrInTime = outOrInTime.substring(0, (outOrInTime.lastIndexOf(".")));
        }
        return outOrInTime;
    }

    public void setOutOrInTime(String outOrInTime) {
        if (StringUtils.isNotBlank(outOrInTime)) {
            outOrInTime = outOrInTime + ".0";
        }
        this.outOrInTime = outOrInTime;
    }

    public String getBatch() {
        return batch;
    }

    public void setBatch(String batch) {
        this.batch = batch;
    }

    public String getProductionIds() {
        return productionIds;
    }

    public void setProductionIds(String productionIds) {
        this.productionIds = productionIds;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }
}
